package com.example.justbuy.service.Impl;

import com.example.justbuy.mapper.AddressMapper;
import com.example.justbuy.pojo.Address;
import com.example.justbuy.pojo.User;
import com.example.justbuy.service.AddressMapperService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;

@Service
public class AddressMapperServiceImpl implements AddressMapperService {
    @Autowired
    private AddressMapper addressMapper;

    public void setAddressMapper(AddressMapper addressMapper) {
        this.addressMapper = addressMapper;
    }

    public AddressMapper getAddressMapper() {
        return addressMapper;
    }

    @Override
    public int AddAddress(HashMap map) {
        return addressMapper.AddAddress(map);
    }

    @Override
    public int SearchUserName(int id) {
        return addressMapper.SearchUserName(id);
    }

    @Override
    public int SetDefaultAddress(String defaul) {
        return addressMapper.SetDefaultAddress(defaul);
    }

    @Override
    public List<Address> GetAllAddress(int userid) {
        return addressMapper.GetAllAddress(userid);
    }

    @Override
    public Address GetDefaultAddress(HashMap map) {
        return addressMapper.GetDefaultAddress(map);
    }

    @Override
    public int DeleteAddress(int id) {
        return addressMapper.DeleteAddress(id);
    }

    @Override
    public int UpdateAddress(Address add) {
        return addressMapper.UpdateAddress(add);
    }

    @Override
    public Address  SearchAddress(int id) {
        return addressMapper.SearchAddress(id);
    }
}
